#include<stdio.h>
#define _CRT_SECOURE_WARNINGS
int main()
{
    const double unit_price = 3.5;
    const double discount1 = 0.05;
    const double discount2 = 0.1;
    const double discount3 = 0.15;
    double tocal_price = 0.0;
    int quantity = 0;

    printf("\n请输入你想要购买的数量：");
    scanf("%d",&quantity);
    tocal_price = quantity*unit_price*(1.0 - (quantity > 50 ? discount3 : 
                                             (quantity > 20 ? discount2 : 
                                             (quantity > 10 ? discount1 : 0.0) )));
    printf("\n您购买%d了件总共需要支付：%.2f￥\n",quantity,tocal_price);

    return 0;
}